﻿@{
    ViewBag.Title = "插件设置";
    List<SelectListItem> typeList = new List<SelectListItem>(){
        new SelectListItem(){ Text="所有类型", Value=""},
        new SelectListItem(){ Text="首页", Value="index"},
        new SelectListItem(){ Text="列表页", Value="list"},
        new SelectListItem(){ Text="栏目页", Value="category"},
        new SelectListItem(){ Text="详细页", Value="detail"},
        new SelectListItem(){ Text="插件页", Value="plugin"},
        new SelectListItem(){ Text="其他页", Value="other"}
    };
}
<div class="pageheader">
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
            <li><a href="javascript:;">系统管理</a> </li>
            <li><a href="javascript:;">定时任务管理</a> </li>
        </ul>
    </div>
</div>
<div class="layui-fluid">
    <div class="layui-card layui-tab">
        <div class="layui-card-body table-tool-mini">
            <div class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-btn-group">
                            <a class="layui-btn icon-btn layui-btn-normal layui-btn-sm" data-type="btnInstall"><i class="iconfont icon-save"></i><span> 安装</span></a>
                            <a class="layui-btn icon-btn layui-btn-normal layui-btn-sm" data-type="btnUnInstall"><i class="iconfont icon-delete"></i><span> 卸载</span></a>
                            <a class="layui-btn icon-btn layui-btn-normal layui-btn-sm" data-type="btnRemark"><i class="iconfont icon-build"></i><span> 生成模板</span></a>
                        </div>
                    </div>
                </div>
            </div>
            <table class="layui-table" lay-data="{page:true, id:'ltable'}" lay-filter="ltable">
                <thead>
                    <tr>
                        <th lay-data="{checkbox:true}"></th>
                        <th lay-data="{field:'name'}">插件名称</th>
                        <th lay-data="{field:'directory'}">目录</th>
                        <th lay-data="{field:'author'}">作者</th>
                        <th lay-data="{field:'version'}">版本号</th>
                        <th lay-data="{field:'description'}">备注</th>
                        <th lay-data="{field:'isload',templet: '#isload'}">状态</th>
                    </tr>
                </thead>
            </table>
            <table class="layui-table" id="ltable" lay-filter="ltable"></table>
        </div>
    </div>
</div>
<script type="text/html" id="isload">
    {{d.isload == 1 ? '已安装' : '未安装'}}
</script>
@section Scripts{
    <script type="text/javascript">
        layui.use(['table', 'cmswh'], function () {
            var table = layui.table, form = layui.form, cmswh = layui.cmswh, $ = layui.jquery;

            cmswh.dataBind('PluginList','',false);
            var active = {
                btnInstall: function () {
                    cmswh.batOperate('PluginInstall', 'directory', "已安装的插件不执行重复安装，是否继续？");
                },
                btnUnInstall: function () {
                    cmswh.batOperate('PluginUninstall', 'directory', "卸载插件不会删除插件目录，是否继续？");
                },
                btnRemark: function () {
                    cmswh.batOperate('PluginRemark', 'directory', "生成模板请先确定是否安装？");
                }
            };
            $('.layui-inline .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
        });
    </script>
}